<?php

namespace App\Api;

class ImageHelper
{
    /**
     * 处理订单详情图片
     * @param $item
     * @return mixed
     */
    public static function handleDetails(&$item): mixed
    {
        $details = $item->details;
        foreach ($details as $detail){
            $detail->good_image = cdn_url($detail->good_image);
            if (!$detail->good_image){
                $detail->good_image = letter_avatar($detail->good_name);
            }
        }
        $item->details = $details;
        return $item;
    }
}
